package com.zzy.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzy.system.domain.SaleOrderDetail;
import com.zzy.system.domain.SaleOrderTracePictures;
import com.zzy.system.mapper.SaleOrderDetailMapper;
import com.zzy.system.mapper.SaleOrderTracePicturesMapper;
import com.zzy.system.service.ISaleOrderDetailService;
import com.zzy.system.service.ISaleOrderTracePicturesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SaleOrderTracePicturesServiceImpl extends ServiceImpl<SaleOrderTracePicturesMapper, SaleOrderTracePictures> implements ISaleOrderTracePicturesService {
    private static final Logger log = LoggerFactory.getLogger(SaleOrderTracePicturesServiceImpl.class);

    @Override
    public void saveOrderTracePictures(List<SaleOrderTracePictures> saleOrderTracePicturesList) {
        if(!saleOrderTracePicturesList.isEmpty()){
            QueryWrapper<SaleOrderTracePictures> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("report_id", saleOrderTracePicturesList.get(0).getReportId());
            baseMapper.delete(queryWrapper);
            this.saveBatch(saleOrderTracePicturesList);
        }
    }
}